export default {
    data() {
        return {
            dlGroup: false, // 开团弹窗变量
            dlShare: false, // 动态、邀请帮卖弹窗变量
            dlPoster: false, // 分享海报图片变量
            shareObject: {}, // 分享海报对象
        }
    },
    onLoad() {
        uni.hideShareMenu({
            menus: ["shareAppMessage"]
        })
    },
    onShareAppMessage(res) {
        const { title, url, shopWindowId } = this.shareObject
        // 分享参数打印
        const _shareObj =  {
            title: title,
            imageUrl: url,
            path: `pagesB/goods/goodsDetails?shopWindowId=${shopWindowId}&shareType=true&idCode=${this.$store.state.userInfo.idCode}`
        }
        // 开团成功之后的
        if (this.shareObject.dynamicId) {
            _shareObj.path = `/pagesB/dynamic/${this.shareObject.mediaType && this.shareObject.mediaType === 1 ? 'graphicsDetail' : 'videoDetail'}?dynamicId=${this.shareObject.dynamicId}&shareType=true&type=2&idCode=${this.$store.state.userInfo.idCode}`
        }
        console.log(JSON.parse(JSON.stringify({_shareObj})), '分享参数打印')
        return _shareObj
    },
    methods: {
        // 帮卖绘制背景图片成功回调函数
        drawSuccess(obj) {
            this.shareObject = obj
            this.dlGroup = true
            uni.hideToast()
        },
        // 点击立即邀请朋友参团
        _customInvite() {
            this.dlShare = true
            this.dlGroup = false
        },
        // 点击生成海报
        _drawPoster() {
            this.dlShare = false
            this.dlPoster = true
        },
    }
}
